// $Id$
// Interface of planetarydynamicsworld
//
// ml278
// Copyright (C) 2008 Bjørn Øivind Bjørnsen, Aleksander Gjermundsen, Knut Andre Tidemann, Thomas Hansen
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

#ifndef __PLANETARYDYNAMICSWORLD_H
#define __PLANETARYDYNAMICSWORLD_H

#include <btBulletDynamicsCommon.h>
#include <vector>
#include "planetarybody.h"

/// Dynamics world which allows for variable gravities (depending on proximity to planets/celestial bodies)
class PlanetaryDynamicsWorld : public btDiscreteDynamicsWorld
{
private:
	/// list of celestial bodies to consider when applying gravity
	std::vector<Ogre::PlanetaryBody*> mPlanetaryBodies;
protected:
	void predictUnconstraintMotionAndGravity(btScalar timeStep);
public:
	PlanetaryDynamicsWorld(btDispatcher*, btBroadphaseInterface*, btConstraintSolver*, btCollisionConfiguration*);
	~PlanetaryDynamicsWorld();
	
	virtual void internalSingleStepSimulation(btScalar timeStep);
	
	void setBodies(std::vector<Ogre::PlanetaryBody*> bodies);
};

#endif // #ifndef __PLANETARYDYNAMICSWORLD_H
